package com.neusoft.util;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
//import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;


//import com.neusoft.bean.T_UserList;
//import com.neusoft.service.UserService;
public class DateConvert extends TagSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6023943296656173086L;
	private String longTime;  
//	@Autowired
//	UserService userService;
//	ClassPathXmlApplicationContext   wac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
//	UserService userService = (UserService)wac.getBean("userService");
    public int doEndTag() throws JspException { 
//    	UserService userService=BeanHolder.getBean(pageContext, "userService");
        long l = 0l;  
        if (longTime!=null&&!longTime.equals("")) {  
            l = Long.parseLong(longTime);  
        }  
        Date date = new Date(l);  
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
        String targetTime = format.format(date);
//        List<T_UserList> list= userService.getAllUser();
        try {  
            super.pageContext.getOut().write(targetTime);  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
        return super.doStartTag();  
    }  
      
    //setter and getter  
    public void setLongTime(String longTime) {  
        this.longTime = longTime;  
    }  
}
